Skip to content

fix(golang): reject go_type specs with slash before type name#4426

Open
SAY-5 wants to merge 1 commit intosqlc-dev:mainfrom
SAY-5:fix/4192-malformed-go-type-spec
Open

fix(golang): reject go_type specs with slash before type name#4426
SAY-5 wants to merge 1 commit intosqlc-dev:mainfrom
SAY-5:fix/4192-malformed-go-type-spec

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 5, 2026

Fixes #4192.

A go_type spec like github.com/foo/pkg/Type (slash before the type name instead of the conventional dot) used to fall back to the last dot anywhere in the spec, which lands inside github.com. The generated models.go ended up with import ("github"), which does not compile.

This change rejects these specs in the parser with the same error already used for specs that contain no dot, pointing the user at the expected 'package.type' format. Adds a regression case in TestTypeOverrides.

Specs like "github.com/foo/pkg/Type" used to silently emit a broken "github" import; require the conventional dot separator. Fixes sqlc-dev#4192.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type override, where new type has an underlying basic type, results in an invalid import

1 participant